.component_thing{
    clear: both;

    &:hover .box, .highlight.box{
        transition: 0.1s ease-out background;
        background: rgba(0,0,0,0.07);
        border-color: var(--super-light);
        border-radius: 5px;
    }
    &:hover .box:not(.loading){
        .component_datetime{display: none;}
        .component_action{display: block;}
    }
    .component_action, .component_checkbox{display: none;}


    .file-is-hover{
        background: var(--emphasis-primary);
    }
    .file-is-dragging{
        opacity: 0.15;
    }


    .file-details{
        padding: 0 5px;
        line-height: 22px;
        white-space: nowrap;
        > span{
            display: inline-block;
            width: calc(100% - 130px);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            vertical-align: bottom;
            color: inherit;
        }
    }
    form{
        display: inline-block;
        input{
            font-size: 1em;
            border-width: 0px;
            padding: 0 2px 0 2px;
            background: inherit;
            border-bottom: 2px solid var(--emphasis-primary);
            color: var(--color);
        }
    }

    .component_icon{
        width: 25px;
        height: 25px;
    }

    .component_filesize{
        span{
            color: var(--light);
            font-size: 0.85em;
        }
    }

    .component_datetime{
        float: right;
        color: var(--light);
        line-height: 25px;
        margin: 0 -10px;
        padding: 0 10px;
        position: relative;
    }

    .component_action{
        float: right;
        color: #6f6f6f;
        line-height: 25px;
        margin: 0 -10px;
        padding: 0 10px;
        position: relative;

        .component_icon{
            padding: 1px 0;
            box-sizing: border-box;
        }
    }

    .component_checkbox{
        opacity: 0;
        z-index: 2;
        position: absolute;
        transition: 0.15s ease-out all;
        transform: translateX(0px);
        padding: 2px;
        border-radius: 50px;
        .indicator {
            top: 7px; left: 7px;
        }
    }
    &:hover .component_checkbox, &.selected .component_checkbox {
        transition-delay: 0.1s;
        opacity: 1;
    }

    .selectionOverlay{ display: none; }
    &.selected .selectionOverlay{
        display: block;
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--primary);
        z-index: 1;
        opacity: 0.3;
    }
}


/* GRID & LIST VIEW */
.list > span{
    display: flex;
    flex-wrap: wrap;
    > .component_thing{
        width: 100%;
        .box{margin: 0px 0 2px 0;}
    }

    // GRID VIEW
    > .component_thing.view-grid{
        width: 25%; .box{ height: 160px;}
        @media (max-width: 699px){width: 33.33%; .box{height: 200px} }
        @media (max-width: 670px){.box{height: 170px}}
        @media (max-width: 550px){width: 50%; .box{height: 200px} }
        @media (max-width: 480px){.box{height: 170px}}
        @media (max-width: 400px){.box{height: 140px; .info_extension{font-size: 0.8em!important; padding: 3px 10px;}}}
        @media (max-width: 340px){.box{height: 130px}}
        text-align: center;
        transition: 0.1s ease transform;

        .box{
            margin: 2px;
            padding: 0;
            position: relative;
            border-width: 0;
            box-sizing: border-box;
            border: 2px solid rgba(100,100,100, 0.1);
            border-radius: 5px;

            > span > img{
                padding: 0;
                margin: 0;
                display: block;
            }
            > span > img.component_icon{
                padding: 30px;
                box-sizing: border-box;
                width: 100%;
                height: 100%;
                object-fit: contain;
                margin: 0 auto;
                z-index: 0;
            }
            > span > img.thumbnail{
                width: 100%;
                height: 100%;
                object-fit: cover;
                object-position: 50% 50%;
                background: var(--dark);
                z-index: 0;
            }
            .info_extension{
                position: absolute;
                top: 45%;
                text-align: right;
                left: 0; right: 20%;
                margin: 0 auto;
                text-transform: uppercase;
                font-size: 0.95em;
                text-shadow: 0px 0px 2px rgba(0,0,0,0.2);
                span{
                    background: var(--color);
                    color: var(--bg-color);
                    border-radius: 4px;
                    padding: 3px 10px;
                    display: inline-block;
                    text-align: center;
                    min-width: 20px;
                    max-width: 65px;
                    white-space: nowrap;
                    overflow: hidden;
                    text-overflow: ellipsis;
                }
            }
            .component_filename{
                letter-spacing: -0.5px;
                z-index: 2;
                position: absolute;
                bottom: 2px;
                left: 2px;
                right: 2px;
                border-radius: 2px;
                padding: 3px 0px;
                .file-details{
                    width: calc(100% - 10px);
                    display: block;
                    > span{
                        width: 100%;
                        form input{
                            letter-spacing: -0.5px;
                            text-align: center;
                            width: 100%;
                            padding: 0;
                        }
                    }
                }
            }
            .image_layer{
                position: absolute;
                top: 0;
                bottom: 0;
                left: 0;
                right: 0;
                z-index: 1;
                background: rgba(0,0,0,0);
                transition: 0.2s ease-out background;
            }
            .component_filesize, .component_datetime{ display: none; }
            .component_action{
                transform: translateX(5px);
                transition: 0.15s ease-out all;
                z-index: 2;
                display: block;
                position: absolute;
                top: 5px;
                right: 5px;
                border-radius: 5px;
                margin-right: 0px;
                padding: 0px;
            }
            img.thumbnail{transition: 0.2s ease-out transform;}
        }
        &.not-selected .box{
            &:hover{
                .component_action{
                    transition-delay: 0.1s;
                    transform: translateX(0);
                }
                img.thumbnail{
                    transform: scale(0.6);
                }
                .image_layer{
                    background: rgba(242, 242, 242, 0.7);
                }
            }
            &.preview{
                &:hover{
                    .component_filename{
                        opacity: 1;
                    }
                }
                .component_filename{
                    transition: 0.2s ease-out opacity;
                    opacity: 0;
                }
            }
        }
        &.selected .box{
            img.thumbnail{
                transform: scale(0.6);
            }
        }
    }

    // LIST VIEW
    > .component_thing.view-grid{
        .component_checkbox {
            display: block;
            top: 3px;
            left: 3px;
            transform: translateX(-5px);
        }
        &:hover .component_checkbox, &.selected .component_checkbox {
            transform: translateX(0px);
        }
    }
    > .component_thing.view-list{
        .component_checkbox {
            top: 8px;
            left: 8px;
            transition: 0.5s ease all;
            background: rgba(0,0,0,0);
        }
        .component_checkbox:hover {
            background: rgba(0,0,0,0.1);
        }

        &:hover .component_checkbox, &.selected .component_checkbox {
            display: block;
            & ~ span > .component_icon { visibility:hidden; } // hide file and folder icon
            .indicator { border-color: var(--color); }
            input ~ span {
                background-color: rgba(255,255,255,0.4);
            }
            input:checked ~ span {
                background-color: var(--color);
            }
        }
    }

    .not-selected .box {
        &:hover .component_action { opacity: 1; }
        .component_action { opacity: 0; }
    }
    .selected .box {
        .component_action { opacity: 0; }
    }
}

.dark-mode .component_thing {
    &:hover .box{
        background: rgba(255,255,255,0.05);
        border-radius: 2px;
    }
    .box{
        background: inherit;
    }
    .component_filename{
        color: var(--light);
    }
    .box.highlight{
        background: rgba(255,255,255,0.05);
    }

    form input {
        border-color: var(--light);
        color: rgba(255,255,255,0.8);
    }
}
